package Reseau;

import java.awt.Point;

public class Noeud {
	public static final Point size = new Point(25,25);
	public static final Point sizeMid = new Point(13,13);
	
	private int x;
	private int y;
	private int numero;
	static int compteurNoeud = 0;
	private double minDistance;
	private Noeud precedent;
	
	public Noeud(int x, int y)
	{
		setPosition(x,y);
		compteurNoeud++;
		numero = compteurNoeud;
	}
	
	public void setPosition(int x, int y){
		this.x = x;
		this.y = y;
	}
	
	public int getX(){
		return x;
	}
	
	public int getY(){
		return y;
	}
	
	public int getNumero(){
		return numero;
	}
	
	public int getXMid(){
		return x + sizeMid.x;
	}
	
	public int getYMid(){
		return y + sizeMid.y;
	}
	
	public Point getPosition(){
		return new Point(x,y);
	}
	
	public void initPathfind(){
		minDistance = Double.POSITIVE_INFINITY;
		precedent = null;
	}
	
	public void setPathfind(double minDistance){
		this.minDistance = minDistance;
	}
	
	public void setPathfind(Noeud precedent){
		this.precedent = precedent;
	}
	
	public void setPathfind(double minDistance, Noeud precedent){
		this.minDistance = minDistance;
		this.precedent = precedent;
	}
	
	public double getMinDistance(){
		return minDistance;
	}
	
	public Noeud getPrecedent(){
		return precedent;
	}
	
	public String toString(){
		return "X:" + getX() + " Y: " + getY();
	}
}
